package com.efuture.io;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * @ClassNAME BufferedInputStreamTest
 * @Description BufferedInputStream的使用
 * @Author zhaoshanshan
 * @Date 2021/9/8 8:47 下午
 * @Version 1.0
 */
public class BufferedInputStreamTest {

    public static void main(String[] args) {
        BufferedInputStream bis = null;
        try{
            bis = new BufferedInputStream(new FileInputStream("javasestudy/src/com.efuture.io/TestFileOne.txt"));
            byte[] bytes = new byte[1024];
            int readCount = -1;
            while ((readCount=bis.read(bytes))!=-1){
                System.out.print(new String(bytes,0,readCount));

            }
        }catch (Exception e){
            e.getStackTrace();
        }finally {
            if(null!=bis){
                try {
                    bis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}